package 牛客.笔试.快手.最长等差数组;

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i = sc.nextInt();
        int sq[] = new int[i];
        for (int q=0;q<i;q++){
            sq[q] = sc.nextInt();
        }
        Arrays.sort(sq);

        int max = 2;
        int maxb = 2;
        int cha = 0;

        for (int q = 0;q<sq.length-1;q++){
            if (cha!=(sq[q+1]-sq[q])){
                maxb = max>maxb?max:maxb;
                cha = sq[q+1]-sq[q];
                max = 2;
            }else max = max+1;
        }
        maxb = max>maxb?max:maxb;
        System.out.println(maxb);
    }

}
